package top.wardyan.base.sqlserver.proc;

import java.util.LinkedHashMap;
import java.util.Map;

@SuppressWarnings("serial")
public class ParameterType {
	//1INT, 2SMALLINT, 3TINYINT, 4BIGINT, 
	//11VARCHAR, 12NVARCHAR, 13CHAR, 14NCHAR, 
	//21FLOAT, 22REAL, 23DECIMAL, 24NUMERIC, 
	//31BINARY, 32VARBINARY, 
	//41BIT, 
	//51TEXT, 52NTEXT, 53IMAGE, 
	//61DATETIME, 62DATE, 63TIME, 64SMALLDATETIME
	public static final Map<String, Integer> types = new LinkedHashMap<String, Integer>(){{
		put("INT", 		1);
		put("SMALLINT", 2);
		//put("tinyint", 3);
		put("BIGINT", 	4);
		put("VARCHAR", 	11);
		put("NVARCHAR", 12);
		put("CHAR", 	13);
		put("NCHAR", 	14);
		put("FLOAT", 	21);
		put("REAL", 	22);
		put("DECIMAL", 	23);
		put("NUMERIC", 	24);
		//put("binary", 31);
		//put("varbinary", 32);
		put("BIT", 		41);
		put("TEXT", 	51);
		put("NTEXT", 	52);
		//put("image", 53);
		put("DATETIME", 61);
		put("DATE", 	62);
		put("TIME", 	63);
		put("SMALLDATETIME", 64);
	}};
	
	public static String getTypeNameByInt(Integer type) {
		for(String t : types.keySet()) {
			if(types.get(t).equals(type))
				return t; 
		}
		return "[UNKNOWN]";
	}

}
